package com.chainyoung.component_tmperson.ui.mvp.model;

import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.integration.IRepositoryManager;
import com.chainyoung.common.mvp.BaseModel;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.api.PersonService;
import com.chainyoung.component_tmperson.entity.CoinItem;
import com.chainyoung.component_tmperson.entity.PurseAddrItem;
import com.chainyoung.component_tmperson.ui.mvp.contract.AddPurseContract;
import com.chainyoung.component_tmperson.ui.mvp.contract.GetPurseListContract;

import java.util.List;
import java.util.TreeMap;

import javax.inject.Inject;

import io.reactivex.Flowable;

@ActivityScope
public class AddPurseModel extends BaseModel implements AddPurseContract.Model {

    @Inject
    AddPurseModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);

    }


    @Override
    public Flowable<String> addPurseAddr(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .addPurseAddr(map)
                .compose(RxUtils.<String>handleResult());
    }


    @Override
    public Flowable<List<CoinItem>> getCoinList(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .getCoinList(map)
                .compose(RxUtils.<List<CoinItem>>handleResult());
    }
}

